import 'package:flutter_app/Model/MineModel.dart';
import 'package:flutter_yfree/main/YFree+Model.dart';

class OrderConfirmModel {
  late AddressModel? item_address;
  late List<OrderConfirmProductModel> items_product;
  late String count;
  late String money;

  OrderConfirmModel.fromJson(Map<dynamic, dynamic> map) {
    item_address = map.byMap("item_address", (rawValue) => AddressModel.fromJson(rawValue), defaultValue: null);
    items_product = map.byList("items_product", (rawValue) => OrderConfirmProductModel.fromJson(rawValue), defaultValue: [])!;
    count = map.byString("count", defaultValue: "0")!;
    money = map.byString("money", defaultValue: "0")!;
  }
}

class OrderConfirmProductModel {
  late String id_product;
  late String id_type;
  late String title_product;
  late String title_type;
  late String img;
  late String money;
  late String count;

  OrderConfirmProductModel.fromJson(Map<dynamic, dynamic> map) {
    id_product = map.byString("id_product", defaultValue: "")!;
    id_type = map.byString("id_type", defaultValue: "")!;
    title_product = map.byString("title_product", defaultValue: "")!;
    title_type = map.byString("title_type", defaultValue: "")!;
    img = map.byString("img", defaultValue: "")!;
    money = map.byString("money", defaultValue: "")!;
    count = map.byString("count", defaultValue: "0")!;
  }
}
